let PoolComponent = require("PoolComponent"); //池子组件
cc.Class({
    extends: PoolComponent,
    properties: {
        starFrame: [cc.SpriteFrame]
    },
    //回收
    unuse: function () {
    },
    //重用
    reuse: function (data) {
        this.data = data;

        this.initStart(data.test)
    },
    onClosed(e) {
        game.emit(game.gameEvent.load_scene, game.gameScene.hall);
        game.emit(game.gameEvent.closed_prefab, this.node);
    },
    start() {
    },

    initStart(percent) {

        let count = 0
        if (percent >= 3 / 4) {
            count = 3
        } else if (percent >= 1 / 2) {
            count = 2
        } else if (percent >= 1 / 4) {
            count = 1
        }

        let layout = this.node.getChildByName('layout')
        for (let i = 0; i < layout.childrenCount; i++) {
            let child = layout.children[i]

            child.getComponent(cc.Sprite).spriteFrame = this.starFrame[i < count ? 0 : 1]

        }
    }
});
